package com.he.fetch.model;

import java.util.HashSet;
import java.util.Set;

public class FetchField {

    private String name;

    private Set<FetchField> successors = new HashSet<FetchField>();

    @Override
    public boolean equals(Object obj) {
	if (this == obj) {
	    return true;
	}
	if (obj == null) {
	    return false;
	}
	if (!(obj instanceof FetchField)) {
	    return false;
	}
	FetchField other = (FetchField) obj;
	if (this.name == null) {
	    if (other.name != null) {
		return false;
	    }
	} else if (!this.name.equals(other.name)) {
	    return false;
	}
	return true;
    }

    public String getName() {
	return this.name;
    }

    public Set<FetchField> getSuccessors() {
	return this.successors;
    }

    @Override
    public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result
		+ (this.name == null ? 0 : this.name.hashCode());
	return result;
    }

    public void setName(String name) {
	this.name = name;
    }

    public void setSuccessors(Set<FetchField> successors) {
	this.successors = successors;
    }

    @Override
    public String toString() {
	return "FetchField [name=" + this.name + "]";
    }

}
